home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
likene1a
/
myprog6.frm
< prev
next >
Wrap
Text File
|
1999-09-24
|
7KB
|
254 lines
VERSION 5.00
Begin VB.Form Form4
BorderStyle = 3 'Fixed Dialog
Caption = "Mouse stuff"
ClientHeight = 1440
ClientLeft = 4515
ClientTop = 4020
ClientWidth = 3120
ControlBox = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form4"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1440
ScaleWidth = 3120
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command14
Caption = "Set mouse pos"
Height = 375
Left = 1560
TabIndex = 7
Top = 720
Width = 1575
End
Begin VB.CommandButton Command25
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "Exit"
Height = 375
Left = 1560
TabIndex = 6
Top = 360
Width = 1575
End
Begin VB.CommandButton Command23
BackColor = &H00C0C0C0&
Caption = "mouse disapear"
Height = 375
Left = 0
TabIndex = 5
Top = 720
Width = 1575
End
Begin VB.CommandButton Command6
BackColor = &H00C0C0C0&
Caption = "Swap mouse"
Height = 375
Left = 1560
TabIndex = 4
Top = 0
Width = 1575
End
Begin VB.CommandButton Command26
Caption = "Get mouse pos"
Height = 375
Left = 0
TabIndex = 3
Top = 360
Width = 1575
End
Begin VB.TextBox text4
Height = 285
Left = 2400
TabIndex = 2
Text = "0"
Top = 1130
Width = 615
End
Begin VB.TextBox Text5
Height = 285
Left = 840
TabIndex = 1
Text = "0"
Top = 1130
Width = 615
End
Begin VB.Timer Timer1
Interval = 1
Left = 3600
Top = 2520
End
Begin VB.CommandButton Command1
BackColor = &H00C0C0C0&
Caption = "Control mouse"
Height = 375
Left = 0
TabIndex = 0
Top = 0
Width = 1575
End
Begin VB.Label Label2
Caption = "Y Axis"
Height = 255
Left = 1680
TabIndex = 9
Top = 1140
Width = 855
End
Begin VB.Label Label1
Caption = "X Axis"
Height = 375
Left = 0
TabIndex = 8
Top = 1140
Width = 975
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mmflag As Boolean
Dim sax As Integer
Dim Say As Integer
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
If Command1.Caption = "Control mouse" Then
Command1.Caption = "stop control"
Else
Command1.Caption = "Control mouse"
End If
If Command1.Caption = "stop control" Then
Timer1.Enabled = True
End If
If Command1.Caption = "Control mouse" Then
Timer1.Enabled = False
End If
End Sub
Private Sub Command14_Click()
g = SetCursorPos(Text5.Text, text4.Text)
End Sub
Private Sub Command23_Click()
If Command23.Caption = "mouse disapear" Then
Command23.Caption = "Mouse reapear"
Else
Command23.Caption = "mouse disapear"
End If
If Command23.Caption = "Mouse reapear" Then
ShowCursor (bShow = True)
End If
If Command23.Caption = "mouse disapear" Then
ShowCursor (bShow = False)
End If
End Sub
Private Sub Command25_Click()
Call ImplodeForm(Me, 2, 500, 1)
Unload Form4
Form12.Show
End Sub
Private Sub Command26_Click()
Ret = GetCursorPos(Pos)
VARIABLE = "(" + CStr(Pos.X) + ", " + CStr(Pos.Y) + ")"
Text5.Text = Pos.X
text4.Text = Pos.Y
End Sub
Private Sub Command6_Click()
If Command6.Caption = "Swap mouse" Then
Command6.Caption = "restore mouse"
Else
Command6.Caption = "Swap mouse"
End If
If Command6.Caption = "restore mouse" Then
SwapMouseButton (1)
End If
If Command6.Caption = "Swap mouse" Then
SwapMouseButton (0)
End If
End Sub
Private Sub Form_Load()
Call ExplodeForm(Me, 500)
Timer1.Enabled = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call ImplodeForm(Me, 2, 500, 1)
End Sub
Private Sub Timer1_Timer()
Dim mousexy As POINTAPI
q = GetCursorPos(mousexy)
Text5.Text = mousexy.X
text4.Text = mousexy.Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim fml As Long
Dim fmt As Long
Dim a As Integer
If mmflag = True Then
fml = Me.Left: fmt = Me.Top
If X > sax Then Me.Left = fml + (X - sax)
If X < sax Then Me.Left = fml - (sax - X)
If Y > Say Then Me.Top = fmt + (Y - Say)
If Y < Say Then Me.Top = fmt - (Say - Y)
End If
End Sub
Private Sub form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If mmflag = False Then
sax = X
Say = Y
mmflag = True
End If
Me.MousePointer = vbSizePointer
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
mmflag = False
Me.MousePointer = vbDefault
End Sub